﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BLToolkit.Mapping;
using BLToolkit.DataAccess;
using DAL;

namespace Entities.Admin
{
    public class TaiKhoan : BaseEntity<TaiKhoan>
    {
        [MapField("UserName"), PrimaryKey]
 
        public string UserName { get; set; }
        public string Password { get; set; }
        [MapField("State")]
        public bool TrangThai { get; set; }
        public int PhanQuyen { get; set; }
        [MapField("IdNhanVien")]
        public string MaNhanVien { get; set; }
        [MapField("IdGiaiDau")]
        public int MaGiaiDau { get; set; }
        [MapIgnore]
        public string TenNhanVien
        {
            get
            {
                NhanVien nv = NhanVien.Objects.GetById(MaNhanVien) ;
                if (nv != null)
                    return nv.TenNhanVien;
                else return null;
            }
        }
        [MapIgnore]
        public string TenGiaiDau
        {
            get
            {
                GiaiDau gd = GiaiDau.Objects.GetById(MaGiaiDau);
                if (gd != null)
                    return gd.TenGiaiDau;
                else return null;
            }
            
        }
        [MapIgnore]
        public string TenTrangThai
        {
            get
            {
                return TrangThai ? "Active" : "Chưa Active";
            }

        }
     

       



    }
}
